<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets">
<h:body styleClass="Corpo" style="font-size:13px;">
	<h:form id="formChFina">

		<div align="center" class="DivCentralizada"
			style="left: 50%; margin-left: -500px;">
			<div align="center"
				style="padding-left: 25px; float: left; padding-right: 24px;">
				<h:outputLabel value="#{message.msg_dataDe} " styleClass="LabelFont" />
				<p:inputMask value="#{chamadoTela.dataDeFiltro}" size="5"
					maxlength="8" style="font-size: 14px;" mask="99/99/99"
					required="true">
				</p:inputMask>
			</div>
			<div align="center" style="float: left;">
				<h:outputLabel value=" #{message.msg_dataAte} "
					styleClass="LabelFont" />
				<p:inputMask value="#{chamadoTela.dataAteFiltro}" size="5"
					maxlength="8" style="font-size: 14px;" mask="99/99/99"
					required="true">
				</p:inputMask>
			</div>

			<div align="center"
				style="float: left; padding-right: 3px; padding-top: 4px;">
				<h:outputLabel value="#{message.label_destino}"
					styleClass="LabelFont" style="margin-left:30px;" />
			</div>
			<div align="center" style="float: left; padding-right: 24px;">
				<p:selectOneMenu value="#{chamadoTela.destinoChamadoFiltro}"
					effect="fade" style="font-size: 13px;"
					valueChangeListener="#{chamadoTela.buscaTipoProblemas}"
					immediate="true">
					<f:selectItem itemLabel="" itemValue="0" />
					<f:selectItems value="#{chamadoTela.destinoChamados}" var="destino"
						itemLabel="#{destino}" itemValue="#{destino}"
						style="font-size: 13px;" />
					<p:ajax update="idTpP" process="@form" />
				</p:selectOneMenu>


			</div>
			<div align="center"
				style="float: left; padding-right: 3px; padding-top: 4px;">
				<h:outputLabel value="#{message.label_assunto}"
					styleClass="LabelFont" style="margin-left:30px;" />
			</div>
			<div align="center" style="float: left; padding-right: 24px;">
				<p:selectOneMenu id="idTpP" value="#{chamadoTela.tipoChamadoFiltro}"
					effect="fade" style="font-size: 13px;">
					<f:selectItem itemLabel="" itemValue="0" />
					<f:selectItems value="#{chamadoTela.tipoProblemas}" var="tipo"
						itemLabel="#{tipo.descricao}" itemValue="#{tipo.codigo}"
						style="font-size: 13px;" />
					<p:ajax />
				</p:selectOneMenu>
			</div>
			<div
				style="padding-left: 12px; padding-right: 24px; float: left; clear: both;">
				<h:outputLabel value="#{message.msg_descri} " styleClass="LabelFont" />
				<p:inputText value="#{chamadoTela.descricaoFiltro}" size="30"
					style="font-size: 14px;">
				</p:inputText>
				<p:commandButton value="#{message.botao_filtrar}"
					icon="ui-icon-search" style="margin-left:30px; font-size: 14px;"
					action="#{chamadoTela.filtraFinalizados}" update="idTChFina" />
			</div>
		</div>
		<div align="left" style="padding-left: 3px; padding-top: 8px;">
			<p:dataTable var="chamado" id="idTChFina"
				value="#{chamadoTela.chamadosFinalizados}"
				paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
				rowsPerPageTemplate="10,15,20" rows="10" paginator="true"
				emptyMessage="#{message.msg_semvalores}">


				<p:column style="width:4%">
					<p:rowToggler />
				</p:column>

				<p:column style="width:10%" sortBy="#{chamado.codigo}">
					<f:facet name="header">  
                    #{message.label_num_chamado} 
            		</f:facet>
					<h:outputText value="#{chamado.codigo}" />
				</p:column>

				<p:column style="width:10%" sortBy="#{chamado.tipoProblema.destinoChamado}">
					<f:facet name="header">  
                    #{message.label_destino} 
            		</f:facet>
					<h:outputText value="#{chamado.tipoProblema.destinoChamado}" />
				</p:column>

				<p:column style="width:10%" sortBy="#{chamado.tipoProblema.descricao}">
					<f:facet name="header">  
                    #{message.label_assunto} 
            		</f:facet>
					<h:outputText value="#{chamado.tipoProblema.descricao}" />
				</p:column>

				<p:column style="width:10%" sortBy="#{chamadoTela.converteData(chamado.dataEmissao)}">
					<f:facet name="header">  
                    #{message.solicita_dt_emissao } 
            		</f:facet>
					<h:outputText
						value="#{chamadoTela.converteData(chamado.dataEmissao)}" />
				</p:column>

				<p:column style="width:10%" sortBy="#{chamadoTela.converteData(chamado.dataAprovacao)}">
					<f:facet name="header">  
                    #{message.label_dt_aprova } 
            		</f:facet>
					<h:outputText
						value="#{chamadoTela.converteData(chamado.dataAprovacao)}" />
				</p:column>

				<p:column style="width:10%" sortBy="#{chamadoTela.converteData(chamado.dataEncerrado)}">
					<f:facet name="header">  
                    #{message.label_dt_finalizado} 
            		</f:facet>
					<h:outputText
						value="#{chamadoTela.converteData(chamado.dataEncerrado)}" />
				</p:column>



				<p:rowExpansion>

					<div style="margin-top: 30px;">
						<div style="float: left; padding-left: 8px;">
							<h:panelGrid columns="2" cellpadding="1" style="width:300px;"
								columnClasses="label, value">


								<h:outputText style="font-weight: bold;"
									value="#{message.label_dt_previsao}" />

								<h:outputText
									value="#{chamadoTela.converteData(chamado.dataPrevisao)}" />

								<h:outputText style="font-weight: bold;"
									value="#{message.label_progresso}" />

								<h:outputText value="#{chamado.progresso}%" />

								<h:outputText style="font-weight: bold;"
									value="#{message.label_anexo}"
									rendered="#{chamado.arquivo != null ? true : false}" />

								<p:commandButton value="#{message.botao_download}"
									icon="ui-icon-arrowthickstop-1-s" ajax="false"
									rendered="#{chamado.arquivo != null ? true : false}">
									<p:fileDownload value="#{chamadoTela.downloadArquivo(chamado)}" />
								</p:commandButton>

								<h:outputText style="font-weight: bold;"
									value="#{message.label_ver_historico}"
									rendered="#{chamado.historicos.size() > 0 ? true : false}" />

								<p:commandButton icon="ui-icon-search"
									action="#{chamadoTela.preencheHistorico(chamado)}"
									oncomplete="dlgHist.show();" update=":descHist"
									rendered="#{chamado.historicos.size() > 0 ? true : false}" />



							</h:panelGrid>
						</div>
						<div style="float: left; margin-left: 30px;">
							<h:panelGrid columns="1" cellpadding="1"
								style="width:700px;center;">
								<h:outputText style="font-weight: bold;"
									value="#{message.label_comentario}" />
								<h:outputText escape="false" value="#{chamado.descricao}" />
							</h:panelGrid>
						</div>

					</div>


				</p:rowExpansion>
			</p:dataTable>
		</div>
	</h:form>
</h:body>

</html>
